package demo.servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class HelloServlet extends HttpServlet {
    /**
     * 构造方法
     */
    public HelloServlet() {
        super();
    }
    /**
     * 初始化方法 
     */
    public void init() throws ServletException {
        System.out.println("初始化时，init()方法被调用!");
    }
    /**
     * doGet()方法
     */
    public void doGet(HttpServletRequest request, 
                     HttpServletResponse response)
                   throws ServletException, IOException {
       System.out.println("处理请求时，doGet()方法被调用。");
    }
    /**
     * doPost()方法
     */
    public void doPost(HttpServletRequest request,
                     HttpServletResponse response)
                     throws ServletException, IOException {
         System.out.println("处理请求时，doPost()方法被调用。");
    }
    /**
     * 用于释放资源 
     */
    public void destroy() {
        super.destroy();
        System.out.println("释放系统资源时，destroy()方法被调用!");
    }
}
